Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix file+noindex URI usage on Windows #10746

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jasagredo
Copy link
Collaborator

@jasagredo jasagredo commented Jan 13, 2025

Concluded on using file+noindex:C:/some/path on Windows as discussed on Matrix.

Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

@jasagredo jasagredo force-pushed the js/local-noindex-2 branch 3 times, most recently from 89c9df2 to 19fad89 Compare January 13, 2025 17:04
@jasagredo jasagredo marked this pull request as ready for review January 13, 2025 17:10
Copy link
Collaborator

@ulysses4ever ulysses4ever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terrific! Any chance for a test?

cabal-install/src/Distribution/Client/Config.hs Outdated Show resolved Hide resolved
@jasagredo
Copy link
Collaborator Author

I can't push because Git operations on github are down at the moment. Will push tomorrow.

As for the tests @ulysses4ever, the current test-suite makes use of this both by the roundtrip of project configurations and by some tests that make use of local+noindex repos such as the ones added recently by @9999years. I consider that sufficient testing.

Copy link
Collaborator

@9999years 9999years left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows paths are so tricky

@ulysses4ever
Copy link
Collaborator

the current test-suite makes use of this both by the roundtrip of project configurations and by some tests that make use of local+noindex repos such as the ones added recently by @9999years. I consider that sufficient testing.

It's just that if anything in the current setup exercises this functionality, I expect the setup to need an update after these changes.

@jasagredo
Copy link
Collaborator Author

The previous PR that was merged did change the OutputNormalizer. It then worked with //./ paths. Now it works with file+noindex:C:/ paths.

@mergify mergify bot added the ready and waiting Mergify is waiting out the cooldown period label Jan 14, 2025
@jasagredo
Copy link
Collaborator Author

jasagredo commented Jan 14, 2025

One could argue that the right syntax would be:

file+noindex:///C:/foo

But that is not understood by network-uri. It is however what .NET does:

➜ [System.Uri]'C:/foo.txt'

AbsolutePath   : C:/foo.txt
AbsoluteUri    : file:///C:/foo.txt
...

In any case .NET also supports the syntax we use here so it should be fine:

➜ [System.Uri]'file:C:/foo.txt'

AbsolutePath   : C:/foo.txt
AbsoluteUri    : file:///C:/foo.txt
...

Probably the right thing to do would be to make use of file-uri for file+noindex paths, but that would require us to not first read it as a network-uri. The good news is that file-uri understands both versions and both are "the same" so once we make this change and recommend file:/// the previous code won't break:

ghci> parseFileURI ExtendedWindows  "file:///C:/foo.txt"
Right (FileURI {fileAuth = Nothing, filePath = "C:/foo.txt"})
ghci> parseFileURI ExtendedWindows  "file:C:/foo.txt"
Right (FileURI {fileAuth = Nothing, filePath = "C:/foo.txt"})

cc @hasufell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attention: needs-backport 3.14 merge me Tell Mergify Bot to merge ready and waiting Mergify is waiting out the cooldown period
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants